import { fromJS } from 'immutable'
import * as constant from './constant'
const defaultState = fromJS({
  Loading: true,
  load2ing: true,
  visible: false,
  title: {},
  nav: {},
  notice1: {},
  notice2: {},
  list: [],
  list2:[],
  writerList: [],
  focusList: []
})
export default ((state = defaultState, action) => {
  switch (action.type){
    case constant.CHANGE_LOAD_OPEN:
     return state.set('Loading', false)
    case constant.CHANGE_LOAD_CLOSE:
     return state.set('Loading', true)
    case constant.CHANGE_LOAD2_OPEN:
     return state.set('Loading2', true)
    case constant.CHANGE_LOAD2_CLOSE:
     return state.set('Loading2', false)
    case constant.HELP_VISIBLE:
    return state.set('visible', true)
    case constant.GET_REMEND:
    return state.merge({
      title: fromJS(action.title),
      nav: fromJS(action.nav),
      notice1: fromJS(action.notice1),
      notice2: fromJS(action.notice2),
      list: fromJS(action.list),
      list2: fromJS(action.list2),
      writerList: fromJS(action.writerList),
      focusList: fromJS(action.focusList)
  
    })
    default:
      return state;
  }
})